/* Original Author:  Dominick O'Dierno
 * Date: 2008   odiernod@gmail.com     --Originally intended for use with DOMercury:  http://www.odierno.com/domercury
 * Description: Provides actions for the Google Item
 * 
 * --CHANGELOG--
 * 
 * */

using System;
using System.Collections.Generic;
using System.Text;
using DOMercury.Interfaces;
using DOMercury.Managers;

namespace DOMercury.Actions
{
    class GoogleSearchAction : IAction
    {
        #region IAction Members

        public string ActionType
        {
            get { return "Search"; }
        }

        public string Description
        {
            get { return "Search Google"; }
        }

        public string ParamDescription
        {
            get { return "Search Keywords"; }
        }

        public string ParameterType
        {
            get { return "CommandLine"; }
        }

        public bool Perform(IItem item, object specialParams)
        {
            System.Diagnostics.Process.Start("http://www.google.com/search?source=ig&hl=en&rlz=&q=" + System.Web.HttpUtility.UrlEncode((string)specialParams));
            return true;
        }

        #endregion
    }

    class GoogleImageSearchAction : IAction
    {
        #region IAction Members

        public string ActionType
        {
            get { return "Image Search"; }
        }

        public string Description
        {
            get { return "Search Google Images"; }
        }

        public string ParamDescription
        {
            get { return "Search Keywords"; }
        }

        public string ParameterType
        {
            get { return "CommandLine"; }
        }

        public bool Perform(IItem item, object specialParams)
        {
            System.Diagnostics.Process.Start("http://images.google.com/images?hl=en&q=" + System.Web.HttpUtility.UrlEncode((string)specialParams) + "&btnG=Search+Images&gbv=2");
            return true;
        }

        #endregion
    }

    class GoogleMapSearchAction : IAction
    {
        #region IAction Members

        public string ActionType
        {
            get { return "Map Search"; }
        }

        public string Description
        {
            get { return "Search Google Maps"; }
        }

        public string ParamDescription
        {
            get { return "Search Keywords"; }
        }

        public string ParameterType
        {
            get { return "CommandLine"; }
        }

        public bool Perform(IItem item, object specialParams)
        {
            System.Diagnostics.Process.Start("http://maps.google.com/maps?hl=en&q=" + System.Web.HttpUtility.UrlEncode((string)specialParams) + "&gbv=2&ie=UTF-8&sa=N&tab=il");
            return true;
        }

        #endregion
    }

    class GoogleProductSearchAction : IAction
    {
        #region IAction Members

        public string ActionType
        {
            get { return "Product Search"; }
        }

        public string Description
        {
            get { return "Search Google Products"; }
        }

        public string ParamDescription
        {
            get { return "Search Keywords"; }
        }

        public string ParameterType
        {
            get { return "CommandLine"; }
        }

        public bool Perform(IItem item, object specialParams)
        {
            System.Diagnostics.Process.Start("http://www.google.com/products?hl=en&q=" + System.Web.HttpUtility.UrlEncode((string)specialParams) + "&ie=UTF-8&sa=N&tab=lf");
            return true;
        }

        #endregion
    }

    class GmailSearchAction : IAction
    {
        #region IAction Members

        public string ActionType
        {
            get { return "GMail Search"; }
        }

        public string Description
        {
            get { return "Search Your Gmail messages"; }
        }

        public string ParamDescription
        {
            get { return "Search Keywords"; }
        }

        public string ParameterType
        {
            get { return "CommandLine"; }
        }

        public bool Perform(IItem item, object specialParams)
        {
            System.Diagnostics.Process.Start("http://mail.google.com/mail/?search=query&view=tl&start=0&init=1&fs=1&q=" + System.Web.HttpUtility.UrlEncode((string)specialParams));
            return true;
        }

        #endregion
    }

    class GoogleVideoSearchAction : IAction
    {
        #region IAction Members

        public string ActionType
        {
            get { return "Video Search"; }
        }

        public string Description
        {
            get { return "Search Google Video"; }
        }

        public string ParamDescription
        {
            get { return "Search Keywords"; }
        }

        public string ParameterType
        {
            get { return "CommandLine"; }
        }

        public bool Perform(IItem item, object specialParams)
        {
            System.Diagnostics.Process.Start("http://video.google.com/videosearch?q=" + System.Web.HttpUtility.UrlEncode((string)specialParams) + "&hl=en&sitesearch=");
            return true;
        }

        #endregion
    }
}
